home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / btoa52.zip / CHKSUM.H < prev    next >
C/C++ Source or Header  |  1994-04-08  |  829b  |  25 lines

  1. /* chksum.h */
  2. /* calcchecksum() was converted to a macro for effectivity reasons. */
  3. /* Don't (!!) give it an argument that has to be evaluated. This    */
  4. /* is guaranteed to slow it down.                                   */
  5.  
  6. /* Update file checksums. */
  7.  
  8. #define calcchecksum(ch)        \
  9. {                               \
  10.   extern LONG Ceor, Csum, Crot; \
  11.                                 \
  12.   Ceor ^= ch;                   \
  13.   Csum += ch + 1;               \
  14.                                 \
  15.   if (Crot & 0x80000000L)       \
  16.   {                             \
  17.     Crot <<= 1;                 \
  18.     Crot ++;                    \
  19.   }                             \
  20.   else                          \
  21.     Crot <<= 1;                 \
  22.                                 \
  23.   Crot += ch;                   \
  24. }
  25.